﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Calculate
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("在算式最后请加 等于 号");
            string a = (Console.ReadLine()).ToString();
            string u = "";
            int p = 0;
            int y = 0;
            int ii = 0;
            int h = 0;
            for (int i = 0; i < a.Length; i++)
            {
                if (a[i].ToString() == "+")
                {
                    if (y == 0)
                    {
                        p = Convert.ToInt32(u);
                        u = "";
                        y += 1;
                        h = 1;
                        continue;
                    }
                    else
                    {
                        if (h == 1)
                        {
                            p = p + Convert.ToInt32(u);
                            u = "";
                            y += 1;
                            h = 1;
                            continue;
                        }
                        else if (h == 2)
                        {
                            p = p - Convert.ToInt32(u);
                            u = "";
                            y += 1;
                            h = 1;
                            continue;
                        }
                        else if (h == 3)
                        {
                            p = p * Convert.ToInt32(u);
                            u = "";
                            y += 1;
                            h = 1;
                            continue;
                        }
                        else if (h == 4)
                        {
                            p = p / Convert.ToInt32(u);
                            u = "";
                            y += 1;
                            h = 1;
                            continue;
                        }
                    }
                }
                else if (a[i].ToString() == "-")
                {
                    if (y == 0)
                    {
                        p = Convert.ToInt32(u);
                        u = "";
                        y += 1;
                        h = 2;
                        continue;
                    }
                    else
                    {
                        if (h == 1)
                        {
                            p = p + Convert.ToInt32(u);
                            u = "";
                            y += 1;
                            h = 2;
                            continue;
                        }
                        else if (h == 2)
                        {
                            p = p - Convert.ToInt32(u);
                            u = "";
                            y += 1;
                            h = 2;
                            continue;
                        }
                        else if (h == 3)
                        {
                            p = p * Convert.ToInt32(u);
                            u = "";
                            y += 1;
                            h = 2;
                            continue;
                        }
                        else if (h == 4)
                        {
                            p = p / Convert.ToInt32(u);
                            u = "";
                            y += 1;
                            h = 2;
                            continue;
                        }
                    }
                    h = 2;
                }
                else if (a[i].ToString() == "*")
                {

                    if (y == 0)
                    {
                        p = Convert.ToInt32(u);
                        u = "";
                        y += 1;
                        h = 3;
                        continue;
                    }
                    else
                    {
                        if (h == 1)
                        {

                            p = p + Convert.ToInt32(u);
                            u = "";
                            y += 1;
                            h = 3;
                            continue;
                        }
                        else if (h == 2)
                        {
                            p = p - Convert.ToInt32(u);
                            u = "";
                            y += 1;
                            h = 3;
                            continue;

                        }
                        else if (h == 3)
                        {
                            p = p * Convert.ToInt32(u);
                            u = "";
                            y += 1;
                            h = 3;
                            continue;
                        }
                        else if (h == 4)
                        {
                            p = p / Convert.ToInt32(u);
                            u = "";
                            y += 1;
                            h = 3;
                            continue;
                        }
                    }
                }
                else if (a[i].ToString() == "/")
                {
                    if (y == 0)
                    {
                        p = Convert.ToInt32(u);
                        u = "";
                        y += 1;
                        h = 4;
                        continue;
                    }
                    else
                    {
                        if (h == 1)
                        {
                            p = p + Convert.ToInt32(u);
                            u = "";
                            y += 1;
                            h = 4;
                            continue;
                        }
                        else if (h == 2)
                        {
                            p = p - Convert.ToInt32(u);
                            u = "";
                            y += 1;
                            h = 4;
                            continue;
                        }
                        else if (h == 3)
                        {
                            p = p * Convert.ToInt32(u);
                            u = "";
                            y += 1;
                            h = 4;
                            continue;
                        }
                        else if (h == 4)
                        {
                            p = p / Convert.ToInt32(u);
                            u = "";
                            y += 1;
                            h = 4;
                            continue;
                        }
                    }
                }
                else if (a[i].ToString() == "=")
                {
                    if (h == 1)
                    {

                        ii = p + Convert.ToInt32(u);
                    }
                    else if (h == 2)
                    {
                        ii = p - Convert.ToInt32(u);

                    }
                    else if (h == 3)
                    {
                        ii = p * Convert.ToInt32(u);
                    }
                    else if (h == 4)
                    {
                        ii = p / Convert.ToInt32(u);
                    }
                }
                u = u + a[i].ToString();
            }
            Console.WriteLine(ii);
            Console.ReadLine();
        }
    }
}